package com.example.demo.web.chat.controller;

import com.example.demo.web.chat.service.ChatService;
import org.noear.solon.annotation.Controller;
import org.noear.solon.annotation.Inject;
import org.noear.solon.annotation.Mapping;
import org.noear.solon.web.sse.SseEmitter;

/**
 * @author airhead
 */
@Controller
@Mapping("/chat")
public class ChatController {
  @Inject private ChatService service;

  @Mapping(value = "/open/{id}")
  public SseEmitter open(String id) {
    return service.open(id);
  }

  @Mapping("/send/{id}")
  public String send(String id) {
    return service.send(id);
  }

  @Mapping("/close/{id}")
  public String close(String id) {
    return service.close(id);
  }
}
